<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="shiro" uri="http://www.springside.org.cn/tags/shiro" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${r"${pageContext.request.contextPath}"}"/>

<html>
<head>
	<title>管理</title>
	
	<!-- select2组合框 -->
	<link rel="stylesheet" type="text/css" href="${r"${ctx}"}/static/metronic/assets/plugins/select2/select2_metro.css"/>
	<script type="text/javascript" src="${r"${ctx}"}/static/metronic/assets/plugins/select2/select2.min.js"></script>
	
    <script>
	${r"$(document)"}.ready(function() {
		${r"$('#inputForm')"}.validate({
            errorElement: 'span', //default input error message container
            errorClass: 'help-block', // default input error message class
            focusInvalid: false, // do not focus the last invalid input
            ignore: ".ignore",

            highlight: function (element) { // hightlight error inputs
                ${r"$(element)"}.closest('.form-group').removeClass('has-success').addClass('has-error'); // set error class to the control group   
                var icon = ${r"$(element)"}.parent('.input-icon').children('i');
            	icon.addClass("fa-warning").removeClass("fa-check");
            },

            unhighlight: function (element) { // revert the change done by hightlight
                ${r"$(element)"}..closest('.form-group').removeClass('has-error').addClass('has-success'); // set success class to the control group
                var icon = ${r"$(element)"}..parent('.input-icon').children('i');
                icon.removeClass("fa-warning").addClass("fa-check");
            },

            success: function (label, element) {
                ${r"$(element)"}..closest('.form-group').removeClass('has-error').addClass('has-success'); // set success class to the control group
                var icon = ${r"$(element)"}..parent('.input-icon').children('i');
                icon.removeClass("fa-warning").addClass("fa-check");
            }
        });
		
	});
	</script>
</head>

<body>
<!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div class="page-content">
			<div class="row">
				<div class="col-md-12">
					<div class="portlet box green">
						<div class="portlet-title">
							<div class="caption">
								<i class="fa fa-reorder"></i>编辑
							</div>
						</div>
						<div class="portlet-body form">
							<!-- BEGIN FORM-->
							
							
							<form id="inputForm" action="${r"${ctx}"}/${path}/${r"${action}"}" enctype="multipart/form-data" method="post" class="form-horizontal">
							<input type="hidden" name="id" value="${r"${"}${english}${r".id}"}"/>
							<div id="messageBox" class="alert alert-error input-large controls" style="display:none">输入有误，请先更正。</div>
								<#list fields as map>
											<#list map?keys as name>
										      <div class="form-body">
													<div class="form-group">
														<label class="col-md-3 control-label"> ${map[name]}：</label>
														<div class="col-md-4">
															<div class="input-icon right">
																<i class="fa"></i>
																			<input type="text" id=" ${map[name]}" name=" ${map[name]}"   class="form-control required" placeholder="" value="${r"${"}${english}${r"."}${map[name]}${r"}"}"  ${r"${action=='view'?'disabled':''}"}> 
															</div>
														</div>
													</div>
												</div>
										      
										    </#list>
										 </#list>
								
								<div class="form-actions fluid">
									<div class="col-md-offset-3 col-md-9">
										<c:if test="${r"${action=='create'}"}">
											<shiro:hasPermission name="${path}:add">
												<button type="submit" class="btn blue">提交</button>
											</shiro:hasPermission>
										</c:if>
										<c:if test="${r"${action=='update'}"}">
											<shiro:hasPermission name="${path}:edit">
												<button type="submit" class="btn blue">提交</button>
											</shiro:hasPermission>
										</c:if>
										<button type="button" class="btn default" onclick="history.back()">取消</button>
									</div>
								</div>
							</form>
							<!-- END FORM-->
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
